package inventory.reports.view;

import javax.swing.JPanel;
import javax.swing.SpringLayout;
import javax.swing.JLabel;
import javax.swing.JComboBox;
import javax.swing.JSeparator;
import javax.swing.JButton;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import javax.swing.JTextField;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Font;
import java.awt.Dimension;

public class CurrentStockReportView extends JPanel 
{
	private JTable table;
	private JTextField textFieldDate;
	
	public CurrentStockReportView() 
	{
		SpringLayout springLayout = new SpringLayout();
		setLayout(springLayout);
		
		JLabel lblDate = new JLabel("Date :");
		lblDate.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		springLayout.putConstraint(SpringLayout.NORTH, lblDate, 10, SpringLayout.NORTH, this);
		springLayout.putConstraint(SpringLayout.WEST, lblDate, 10, SpringLayout.WEST, this);
		add(lblDate);
		
		textFieldDate = new JTextField();
		textFieldDate.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		springLayout.putConstraint(SpringLayout.NORTH, textFieldDate, 10, SpringLayout.NORTH, this);
		springLayout.putConstraint(SpringLayout.WEST, textFieldDate, 6, SpringLayout.EAST,lblDate);
		add(textFieldDate);
		textFieldDate.setColumns(10);
		
		JButton btnDate = new JButton("Cl");
		springLayout.putConstraint(SpringLayout.NORTH, btnDate, 0, SpringLayout.NORTH, lblDate);
		springLayout.putConstraint(SpringLayout.WEST, btnDate, 6, SpringLayout.EAST, textFieldDate);
		btnDate.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		btnDate.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
			}
		});
		add(btnDate);
		
		JLabel lblCategory = new JLabel("Category :");
		lblCategory.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		springLayout.putConstraint(SpringLayout.NORTH, lblCategory, 30, SpringLayout.NORTH,lblDate);
		springLayout.putConstraint(SpringLayout.WEST, lblCategory, 10, SpringLayout.WEST, this);
		add(lblCategory);
		
		JComboBox comboBoxCategory = new JComboBox();
		springLayout.putConstraint(SpringLayout.NORTH, comboBoxCategory, 0, SpringLayout.NORTH, lblCategory);
		springLayout.putConstraint(SpringLayout.WEST, comboBoxCategory, 6, SpringLayout.EAST, lblCategory);
		comboBoxCategory.setPreferredSize(new Dimension(200, 20));
		comboBoxCategory.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		add(comboBoxCategory);
		
		JLabel lblMaterial = new JLabel("Material :");
		lblMaterial.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		springLayout.putConstraint(SpringLayout.NORTH, lblMaterial, 0, SpringLayout.NORTH, lblCategory);
		springLayout.putConstraint(SpringLayout.WEST, lblMaterial, 30, SpringLayout.EAST,comboBoxCategory);
		add(lblMaterial);
		
		JComboBox comboBoxMaterial = new JComboBox();
		comboBoxMaterial.setPreferredSize(new Dimension(200, 20));
		comboBoxMaterial.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		springLayout.putConstraint(SpringLayout.NORTH, comboBoxMaterial, 0, SpringLayout.NORTH, lblMaterial);
		springLayout.putConstraint(SpringLayout.WEST, comboBoxMaterial, 6, SpringLayout.EAST, lblMaterial);
		add(comboBoxMaterial);
		
		JSeparator separator = new JSeparator();
		springLayout.putConstraint(SpringLayout.NORTH, separator, 10, SpringLayout.SOUTH, comboBoxCategory);
		springLayout.putConstraint(SpringLayout.WEST, separator, 10, SpringLayout.WEST, this);
		springLayout.putConstraint(SpringLayout.EAST, separator, -10, SpringLayout.EAST, this);
		add(separator);
		
		JButton btnSubmit = new JButton("SUBMIT");
		btnSubmit.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.WEST, btnSubmit, 10, SpringLayout.WEST, this);
		springLayout.putConstraint(SpringLayout.SOUTH, btnSubmit, -10, SpringLayout.SOUTH, this);
		add(btnSubmit);
		
		JScrollPane scrollPane = new JScrollPane();
		springLayout.putConstraint(SpringLayout.NORTH, scrollPane, 10, SpringLayout.SOUTH, separator);
		springLayout.putConstraint(SpringLayout.WEST, scrollPane, 10, SpringLayout.WEST,this);
		springLayout.putConstraint(SpringLayout.SOUTH, scrollPane,-10, SpringLayout.NORTH,btnSubmit);
		springLayout.putConstraint(SpringLayout.EAST, scrollPane, -10, SpringLayout.EAST, this);
		add(scrollPane);
		
		JButton btnPrint = new JButton("PRINT");
		btnPrint.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, btnPrint, 10, SpringLayout.NORTH, this);
		springLayout.putConstraint(SpringLayout.EAST, btnPrint, -10, SpringLayout.EAST, this);
		add(btnPrint);
		
		table = new JTable();
		table.setModel(new DefaultTableModel(
			new Object[][] {
				{null, null, null, null, null, null},
			},
			new String[] {
				"SR. NO", "NAME", "SPECIFCATION", "BALANCE", "RATE", "AMOUNT"
			}
		));
		table.getColumnModel().getColumn(1).setPreferredWidth(120);
		table.getColumnModel().getColumn(2).setPreferredWidth(104);
		scrollPane.setViewportView(table);
	}
}
